﻿<UserControl x:Class="FSharpEditorEnhancements.FSharpJumpList"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:l="clr-namespace:FSharpEditorEnhancements"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300"
             PreviewKeyDown="FSharpJumpList_PreviewKeyDown"
             PreviewTextInput="FSharpJumpList_TextInput">
    <Grid Name="topGrid">
        <Grid.Resources>
            <!-- images -->
            <BitmapImage x:Key="module" UriSource="images/Module.png" />
            <BitmapImage x:Key="namespace" UriSource="images/Namespace.png" />
            <BitmapImage x:Key="let" UriSource="images/Let.png" />
            <BitmapImage x:Key="type" UriSource="images/Type.png" />
            <BitmapImage x:Key="member" UriSource="images/Member.png" />
            <BitmapImage x:Key="staticMember" UriSource="images/StaticMember.png" />
            <BitmapImage x:Key="marker" UriSource="images/Marker.png" />
            <!-- level brushes -->
            <SolidColorBrush x:Key="level1" Color="Black" />
            <SolidColorBrush x:Key="level2" Color="Green" />
            <SolidColorBrush x:Key="level3" Color="LightGreen" />
            <SolidColorBrush x:Key="level4" Color="LightGray" />
            <Style x:Key="s1" TargetType="{x:Type TextBlock}">
                <Setter Property="FontSize" Value="12" />
                <Setter Property="FontWeight" Value="Bold" />
            </Style>
            <Style x:Key="s2" TargetType="{x:Type TextBlock}">
                <Setter Property="FontSize" Value="12" />
                <Setter Property="FontWeight" Value="Normal" />
            </Style>
            <Style x:Key="s3" TargetType="{x:Type TextBlock}">
                <Setter Property="FontSize" Value="11" />
                <Setter Property="FontStyle" Value="Italic" />
            </Style>
            <Style x:Key="s4" TargetType="{x:Type TextBlock}">
                <Setter Property="FontSize" Value="10" />
            </Style>
            <!-- converters -->
            <l:ToImage x:Key="toImage" />
            <l:ToShade x:Key="toShade" />
            <l:ToStyle x:Key="toStyle" />
            <l:WiderWidth x:Key="ww" />
        </Grid.Resources>
        <ListBox
            Name="lb1"
            Loaded="lb1_Loaded"
            Unloaded="lb1_Unloaded"
            MouseDoubleClick="lb1_MouseDoubleClick">
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <!--<StackPanel Orientation="Horizontal" Margin="{Binding ., Converter={StaticResource l2m}}">-->
                    <StackPanel Orientation="Horizontal">
                        <Rectangle
                            Width="{Binding Level, Converter={StaticResource ww}}"
                            Height="2"
                            HorizontalAlignment="Stretch" VerticalAlignment="Center">
                            <Rectangle.Fill>
                                <MultiBinding Converter="{StaticResource toShade}">
                                    <Binding Path="." />
                                    <Binding ElementName="topGrid" />
                                </MultiBinding>
                            </Rectangle.Fill>
                        </Rectangle>
                        <Image>
                            <Image.Source>
                                <MultiBinding Converter="{StaticResource toImage}">
                                    <Binding Path="." />
                                    <Binding ElementName="topGrid" />
                                </MultiBinding>
                            </Image.Source>
                        </Image>
                        <TextBlock Text="{Binding Name}" Margin="2">
                            <TextBlock.Style>
                                <MultiBinding Converter="{StaticResource toStyle}">
                                    <Binding Path="." />
                                    <Binding ElementName="topGrid" />
                                </MultiBinding>                                
                            </TextBlock.Style>
                        </TextBlock>
                     </StackPanel>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
        <!--<Rectangle Width="40" Height="40" Fill="Chartreuse" Margin="20" HorizontalAlignment="Right" VerticalAlignment="Top" 
                   MouseDown="ExpandCollapse_Click" Cursor="Arrow" />-->
    </Grid>
</UserControl>
